//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_weaprespawn1.sqf"
#include "xr_macros.sqf"

private ["_body", "_oabackpackmags", "_oabackpackweaps", "_ubp", "_ubackp", "_weapons", "_magazines"];
_body = player;
#ifdef __OAXR__
_oabackpackmags = [[],[]];
_oabackpackweaps = [[],[]];
__pSetVar [QGVARXR(oabackpackmags), _oabackpackmags];
__pSetVar [QGVARXR(oabackpackweaps), _oabackpackweaps];
_ubp = unitBackpack _body;
_ubackp = if (!isNull _ubp) then {typeOf _ubp} else {""};
__pSetVar [QGVARXR(ubp), _ubackp];
if (_ubackp != "") then {
	_oabackpackmags = getMagazineCargo _ubp;
	_oabackpackweaps = getWeaponCargo _ubp;
	__pSetVar [QGVARXR(oabackpackmags), _oabackpackmags];
	__pSetVar [QGVARXR(oabackpackweaps), _oabackpackweaps];
};
#endif
_weapons = weapons _body;
_magazines = magazines _body;
__pSetVar [QGVARXR(weapons), _weapons];
__pSetVar [QGVARXR(magazines), _magazines];
if (GVARXR(dead_removeweapon)) then {
	if (primaryWeapon _body != "") then {
		_body removeWeapon (primaryWeapon _body);
	};
	if (secondaryWeapon _body != "") then {
		_body removeWeapon (secondaryWeapon _body);
	};
};